var AaAssistant = Class.create(AbstractModule, {


setupWidgets: function() {

		//About
		this.controller.setupWidget(Mojo.Menu.appMenu, {
			omitDefaultItems: true
		}, {
			visible: true,
			items: [
      		Mojo.Menu.editItem,
			{ label: "Disclaimer", command: "do-disclaimer" },					
				{ label: "License", command: "do-license" },
				{ label: "Help", command: "do-help" }
			]
		});

	this.controller.setupWidget("fio2Field", {
		charsAllow: isValidFPNumber,
		modifierState: Mojo.Widget.numLock	

		},{
       value: "21"
   });
		
		this.controller.setupWidget("paco2Field", {
		charsAllow: isValidFPNumber,
		modifierState: Mojo.Widget.numLock

  }, {});
	
		this.controller.setupWidget("pao2Field", {
		charsAllow: isValidFPNumber,
		modifierState: Mojo.Widget.numLock
	}, {});
	
},



	calculate: function() {
	var result = aacalc($("fio2Field").mojo.getValue(),$("paco2Field").mojo.getValue(),$("pao2Field").mojo.getValue());

//	var aaresult= result.aagrad;
	var interp="";
	
	
	if (result.fierror==1){	
  	interp="The fiO2 exceeds the upper limit of 100";
	 return interp;
	}
	
  if (result.fierror==0){	
		return "The A-a gradient is " + result.aagrad +" torr.";
  }
		
	}
});





